﻿@model IEnumerable<TaoNiuOA.Models.User>
@{
    ViewBag.Title = "用户管理";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
<script type="text/javascript">
    function showStatus(obj) {
        if (obj == 1) {
            document.write("正常");
        }
        else
            document.write("禁用");
    }
</script>
<h2>
    用户管理
</h2>
<p>
    @Html.ActionLink("添加用户", "adduser")
</p>
<table>
    <tr>
        <th>
            用户名
        </th>
        <th>
            姓名
        </th>
        <th>
            邮箱
        </th>
        <th>
            上次登录
        </th>
        <th>
            部门
        </th>
        <th>
            职位
        </th>
        <th>
            状态
        </th>
        <th>
            操作
        </th>
    </tr>
    @foreach (var item in Model)
    {
        <tr>
            <td>
                <a href="/user/details/@item.UserID">@item.UserName</a>
            </td>
            <td>
                @item.GetUserInfo().Name
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Email)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.LastActivityTime)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.GetDepartment().Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.GetUserGroup().GroupName)
            </td>
            <td>
                <script>         
                       showStatus(@item.Status);
                </script>
            </td>
            <td>
                @Html.ActionLink("编辑", "Edit", new { id = item.UserID }) |
                @Html.ActionLink("详细", "Details", new { id = item.UserID })
            </td>
        </tr>
    }
</table>

